import pyglet
from pyglet.window import key
from config import *
import random


class PipeA(pyglet.sprite.Sprite):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.new = True

    def update(self, t):
        t = t * 60

        self.x = self.x - t * speed
        # -n*管个数-屏幕宽度
        if self.x < -700:
            self.x = 800
            self.new = True


class PipeB(pyglet.sprite.Sprite):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.new = True

    def update(self, t):
        t = t * 60
        self.x = self.x - t * speed
        # -n*管个数-屏幕宽度
        if self.x < -700:
            self.x = 800
            self.new = True
